//
//  SceneManager.cpp
//  myGame
//
//  Created by startiasoft on 13-11-27.
//
//

#include "SceneManager.h"
#include "MapEditScene.h"



SceneManager* SceneManager::m_SceneManager = NULL;

SceneManager* SceneManager::createScene() {
    if(m_SceneManager == NULL) {
        m_SceneManager = new SceneManager();
        if(m_SceneManager && m_SceneManager->init()) {
            m_SceneManager->autorelease();
        }
        else {
            CC_SAFE_DELETE(m_SceneManager);
            m_SceneManager = NULL;
        }
    }
    
    return m_SceneManager;
}

bool SceneManager::init() {
    
    return true;
}

void SceneManager::changeScene(SceneManager::EnumSceneType enSceneType) {
    Scene* pScene = NULL;
    switch (enSceneType) {
        case en_GameStartScene:
            //pScene = GameStartScene::createScene();
            break;
        case en_GameRunScene:
            //pScene = GameRunScene::createScene();
            break;
		case en_MapEditScene:
			pScene = MapEditScene::createScene();
        default:
            break;
    }
    Director* pDirector = Director::getInstance();
    Scene* curScene = pDirector->getRunningScene();
    
    float time = 1.0f;
    TransitionScene* repScene = NULL;
    repScene = CCTransitionJumpZoom::create(time, pScene);
    
    if (curScene == NULL) {
        pDirector->runWithScene(pScene);
    } else {
        pDirector->replaceScene(repScene);
    }
}